package bidsanity

import static org.junit.Assert.*
import org.junit.*

class CustomerIntegrationTests {

    @Before
    void setUp() {
        // Setup logic here
    }

    @After
    void tearDown() {
        // Tear down logic here
    }

    @Test
    void testMultipleAdds() {
        def c = [new Customer(emailAddress:  'test@example.org', password: "testing"),
                new Customer(emailAddress:  'test1@example.org', password: "testing")]
        c*.save()
        Assert.assertNotNull(Customer.findByEmailAddress('test@example.org'))
        Assert.assertNotNull(Customer.findByEmailAddress('test1@example.org'))

    }

    @Test
    void testUniqueEmailAddress() {
        //seems to be some bleed over from other tests...used a unique email address for this test.
        def c = [new Customer(emailAddress:  'testUnique@example.org', password: "testing"),
                new Customer(emailAddress:  'testUnique@example.org', password: "testing")]
        c*.save()
        Assert.assertEquals( 1, Customer.findAllByEmailAddress('testUnique@example.org').size())
    }
}

